package C_Paper;

import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class C100_19 {
    public static void main(String[] args) {
        jf("xyyxxy");
    }
    public static void jf(String str){
        char c = str.charAt(0);
        int num = 1;
        int n = 0;
        for (int i = 1; i < str.length(); i++) {
            char m = str.charAt(i);
            if (m == c) num ++;
            else num--;
            if (num == 0) n++;
        }
        System.out.println(n);
    }
}
